﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ClipWpf;

namespace ClipForm
{
    public partial class Form1 : Form, IDisposable //?? why IDisposable
    {
        public Form1()
        {
            InitializeComponent();

            // show window on top of other windows
            TopLevel = true;
            TopMost = true;
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            
            //Keys k = Keys.A | Keys.Control;

            Keys k = Keys.F15;
            WindowsShell.RegisterHotKey(this, k);
        }
        
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);

            if (m.Msg == WindowsShell.WM_HOTKEY)
                this.Visible = !this.Visible;
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            WindowsShell.UnregisterHotKey(this);
        }
    }
}


